local skel = fk.CreateSkill {
  name = "emo__goujunfa",
  max_turn_use_time = 1,
}

Fk:loadTranslationTable{
  ["emo__goujunfa"] = "狗军阀",
  [":emo__goujunfa"] = "每回合限一次，你成为伤害牌的唯一目标后，你可以令此牌对你无效，然后其余角色依次可以对你使用【杀】。",

  ["#emo__goujunfa-ask"] = "狗军阀:你可以令 %arg 对你无效，但其余角色可以再【杀】你。",
  ["#emo__goujunfa-slash"] = "狗军阀:你可以对 %src 使用【杀】！",

  ["$emo__goujunfa1"] = "畜生里的畜生？你跟他有很大仇啊",
  ["$emo__goujunfa2"] = "",
}

skel:addEffect(fk.TargetConfirmed, {
  anim_type = "defensive",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and data.card.is_damage_card and data:isOnlyTarget(player)
    and player:usedSkillTimes(skel.name) == 0
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player, { skill_name = skel.name, prompt = "#emo__goujunfa-ask:::"..data.card:toLogString() })
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    data:setNullified(player)
    for _, p in ipairs(room:getAlivePlayers()) do
      if player.dead then break end
      if p ~= player and p ~= data.from and not p.dead then
        local use = room:askToUseCard(p, {
          pattern = "slash", skill_name = skel.name, prompt = "#emo__goujunfa-slash:"..player.id,
          extra_data = {
            bypass_distances = true, bypass_times = true,
            exclusive_targets = {player.id},
          }
        })
        if use then
          use.extraUse = true
          room:useCard(use)
        end
      end
    end
  end,
})

return skel
